

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The available built-in commands are: &mdash; BetterBatch v1.3.2 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.3.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="BetterBatch v1.3.2 documentation" href="index.html" />
    <link rel="next" title="Comparing BetterBatch to ..." href="comparison.html" />
    <link rel="prev" title="BetterBatch Readme" href="readme.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="comparison.html" title="Comparing BetterBatch to ..."
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="readme.html" title="BetterBatch Readme"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">BetterBatch v1.3.2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="the-available-built-in-commands-are">
<h1><a class="toc-backref" href="#id3">The available built-in commands are:</a><a class="headerlink" href="#the-available-built-in-commands-are" title="Permalink to this headline">¶</a></h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#the-available-built-in-commands-are" id="id3">The available built-in commands are:</a><ul>
<li><a class="reference internal" href="#running-shell-external-commands" id="id4">Running shell/external commands</a><ul>
<li><a class="reference internal" href="#run-aliases-execute-system-default" id="id5">run (aliases: execute, system). (default)</a></li>
<li><a class="reference internal" href="#which" id="id6">which</a></li>
</ul>
</li>
<li><a class="reference internal" href="#path-manipulation" id="id7">Path Manipulation</a><ul>
<li><a class="reference internal" href="#dirname" id="id8">dirname</a></li>
<li><a class="reference internal" href="#filename-aliases-basename" id="id9">filename    (aliases basename)</a></li>
<li><a class="reference internal" href="#abspath" id="id10">abspath</a></li>
<li><a class="reference internal" href="#shortpathname" id="id11">ShortPathName</a></li>
</ul>
</li>
<li><a class="reference internal" href="#file-manipulation" id="id12">File Manipulation</a><ul>
<li><a class="reference internal" href="#find-in-file" id="id13">find_in_file</a></li>
<li><a class="reference internal" href="#replace-in-file" id="id14">replace_in_file</a></li>
<li><a class="reference internal" href="#listfilesmatchingpattern" id="id15">ListFilesMatchingPattern</a></li>
<li><a class="reference internal" href="#count" id="id16">count</a></li>
<li><a class="reference internal" href="#exists-aliases-exist" id="id17">exists  (aliases exist)</a></li>
<li><a class="reference internal" href="#notexists-aliases-notexist" id="id18">notexists  (aliases notexist)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#string-text-manipulation" id="id19">String/text Manipulation</a><ul>
<li><a class="reference internal" href="#escapenewlines-aliases-escape-newlines" id="id20">escapenewlines  (aliases escape_newlines)</a></li>
<li><a class="reference internal" href="#replace" id="id21">replace</a></li>
<li><a class="reference internal" href="#compare" id="id22">compare</a></li>
<li><a class="reference internal" href="#upper-aliases-uppercase" id="id23">upper  (aliases uppercase)</a></li>
<li><a class="reference internal" href="#lower-aliases-lowercase" id="id24">lower  (aliases lowercase)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#registry-manipulation" id="id25">Registry Manipulation</a><ul>
<li><a class="reference internal" href="#getregistryvalue" id="id26">GetRegistryValue</a></li>
<li><a class="reference internal" href="#setregistryvalue" id="id27">SetRegistryValue</a></li>
</ul>
</li>
<li><a class="reference internal" href="#miscelaneous-commands" id="id28">Miscelaneous commands</a><ul>
<li><a class="reference internal" href="#getlanguage" id="id29">GetLanguage</a></li>
<li><a class="reference internal" href="#add-tools-dir" id="id30">add_tools_dir</a></li>
<li><a class="reference internal" href="#split" id="id31">split</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="running-shell-external-commands">
<h2><a class="toc-backref" href="#id4">Running shell/external commands</a><a class="headerlink" href="#running-shell-external-commands" title="Permalink to this headline">¶</a></h2>
<div class="section" id="run-aliases-execute-system-default">
<h3><a class="toc-backref" href="#id5">run (aliases: execute, system). (default)</a><a class="headerlink" href="#run-aliases-execute-system-default" title="Permalink to this headline">¶</a></h3>
<p>Execute a single command on the command line shell.
This is the default command - you do not need to and should not use
the <tt class="docutils literal"><span class="pre">run</span></tt> command itself - just call the command.</p>
<p>It can take the following qualifiers:</p>
<dl class="docutils">
<dt><strong>echo</strong></dt>
<dd><p class="first">Output is echo&#8217;ed to the terminal.</p>
<p class="last">Prior to BetterBatch 1.2.0 output was echoed AFTER the process
finished (unless <em>ui</em> qualifier was used).
Since 1.2.0 output is echoed as it generated. As such <strong>echo</strong> and <strong>ui</strong>
qualifiers have been merged (and <strong>ui</strong> is now just an alias for <strong>echo</strong>.)</p>
</dd>
<dt><strong>nocapture</strong></dt>
<dd>Output will not be captured to the log file.</dd>
<dt><strong>nocheck</strong></dt>
<dd>Do not check the return value. Default is to raise an
exception if the return value is not 0 (success)</dd>
<dt><strong>ui</strong></dt>
<dd><p class="first">Alias for <strong>echo</strong> (since 1.2.0)</p>
<p class="last">To achieve the pre-1.2.0 functionality (where <strong>ui</strong> stopped capturing
of output to the log file) specify <strong>nocapture</strong> &amp; <strong>echo</strong> instead.</p>
</dd>
</dl>
</div>
<div class="section" id="which">
<h3><a class="toc-backref" href="#id6">which</a><a class="headerlink" href="#which" title="Permalink to this headline">¶</a></h3>
<p>Simliar to the <a href="#id1"><span class="problematic" id="id2">*</span></a>nix shell command, this tool allows you to find the path of
which (if any) command will be executed for a specific command.</p>
<p>e.g. if you run:</p>
<div class="highlight-python"><pre>which notepad</pre>
</div>
<p>it will return:</p>
<div class="highlight-python"><pre>C:\WINDOWS\system32\notepad.EXE</pre>
</div>
<p>Here is the help output:</p>
<div class="highlight-python"><pre>Show the full path of commands.

Usage:
    which [&lt;options&gt;...] [&lt;command-name&gt;...]

Options:
    -h, --help      Print this help and exit.
    -V, --version   Print the version info and exit.

    -a, --all       Print *all* matching paths.
    -v, --verbose   Print out how matches were located and
                    show near misses on stderr.
    -q, --quiet     Just print out matches. I.e., do not print out
                    near misses.

    -p &lt;altpath&gt;, --path=&lt;altpath&gt;
                    An alternative path (list of directories) may
                    be specified for searching.
    -e &lt;exts&gt;, --exts=&lt;exts&gt;
                    Specify a list of extensions to consider instead
                    of the usual list (';'-separate list, Windows
                    only).

Show the full path to the program that would be run for each given
command name, if any. Which, like GNU's which, returns the number of
failed arguments, or -1 when no &lt;command-name&gt; was given.

Near misses include duplicates, non-regular files and (on Un*x)
files without executable access.</pre>
</div>
<p>This tool was included from <a class="reference external" href="http://code.google.com/p/which/">http://code.google.com/p/which/</a>.
Please refer to the <tt class="docutils literal"><span class="pre">betterbatch\tools\LICENSE_Which.txt</span></tt> file for licensing
information.</p>
</div>
</div>
<div class="section" id="path-manipulation">
<h2><a class="toc-backref" href="#id7">Path Manipulation</a><a class="headerlink" href="#path-manipulation" title="Permalink to this headline">¶</a></h2>
<div class="section" id="dirname">
<h3><a class="toc-backref" href="#id8">dirname</a><a class="headerlink" href="#dirname" title="Permalink to this headline">¶</a></h3>
<p>Return the directory (or parent directory for a directory) of the
path passed in.</p>
</div>
<div class="section" id="filename-aliases-basename">
<h3><a class="toc-backref" href="#id9">filename    (aliases basename)</a><a class="headerlink" href="#filename-aliases-basename" title="Permalink to this headline">¶</a></h3>
<p>Return the filename (or directory name for a directory) of the
path passed in.</p>
</div>
<div class="section" id="abspath">
<h3><a class="toc-backref" href="#id10">abspath</a><a class="headerlink" href="#abspath" title="Permalink to this headline">¶</a></h3>
<p>Return the absolute path of the file.</p>
</div>
<div class="section" id="shortpathname">
<h3><a class="toc-backref" href="#id11">ShortPathName</a><a class="headerlink" href="#shortpathname" title="Permalink to this headline">¶</a></h3>
<p>Return the short path name of the filename</p>
</div>
</div>
<div class="section" id="file-manipulation">
<h2><a class="toc-backref" href="#id12">File Manipulation</a><a class="headerlink" href="#file-manipulation" title="Permalink to this headline">¶</a></h2>
<div class="section" id="find-in-file">
<h3><a class="toc-backref" href="#id13">find_in_file</a><a class="headerlink" href="#find-in-file" title="Permalink to this headline">¶</a></h3>
<p>Return true if the text is in the file. It will output the found items
one per line.</p>
<p>Usage: $prog [-r] file text_to_find [text_to_find...]</p>
<dl class="docutils">
<dt>Options:</dt>
<dd><table class="first last docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></td>
<td>show this help message and exit</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-r</span>, <span class="option">--regex</span></kbd></td>
<td>search and replacement are regular expressions</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-n</span>, <span class="option">--noerr</span></kbd></td>
<td>do not report an error if the text is not found</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-i</span>, <span class="option">--ignorecase</span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>ignore case when searching</td></tr>
</tbody>
</table>
</dd>
</dl>
</div>
<div class="section" id="replace-in-file">
<h3><a class="toc-backref" href="#id14">replace_in_file</a><a class="headerlink" href="#replace-in-file" title="Permalink to this headline">¶</a></h3>
<p>Replace text in file</p>
<p>Usage: $prog [-rn] [&#8211;encoding enc] filepath to_find replace_with</p>
<dl class="docutils">
<dt>Options:</dt>
<dd><table class="first last docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></td>
<td>show this help message and exit</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-r</span>, <span class="option">--regex</span></kbd></td>
<td>search and replacement are regular expressions</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-n</span>, <span class="option">--noerr</span></kbd></td>
<td>do not report an error if the text is not found</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--encoding</span></kbd></td>
<td>(auto,none,...)
specify the encoding of the text. A value of &#8216;AUTO&#8217;
will have the script try and find out the encoding -
based on any BOMs present. A value of &#8216;NONE&#8217; (default)
will not decode the contents. The contents will be
processed as &#8216;binary&#8217;. Any other value should be a
valid Python encoding see
<a class="reference external" href="http://docs.python.org/library/codecs.html#standard-encodings">http://docs.python.org/library/codecs.html#standard-encodings</a>.</td></tr>
</tbody>
</table>
</dd>
</dl>
</div>
<div class="section" id="listfilesmatchingpattern">
<h3><a class="toc-backref" href="#id15">ListFilesMatchingPattern</a><a class="headerlink" href="#listfilesmatchingpattern" title="Permalink to this headline">¶</a></h3>
<p>Output a list of all the files matching the supplied pattern.</p>
<p>Usage: ListFilesMatchingPattern [options] (path) (patern1) (pattern2) ...</p>
<dl class="docutils">
<dt>Options:</dt>
<dd><table class="first last docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></td>
<td>show this help message and exit</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-s</span>, <span class="option">--recursive</span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>scan recursively</td></tr>
</tbody>
</table>
</dd>
</dl>
<p>This is especially useful in a loop to iterate over a particular set of files.</p>
<p>Example:</p>
<div class="highlight-python"><pre>- for file in {{{ ListFilesMatchingPattern -s &lt;xml_folder&gt; *.xml *.xsl }}}:
   - echo &lt;file&gt;</pre>
</div>
</div>
<div class="section" id="count">
<h3><a class="toc-backref" href="#id16">count</a><a class="headerlink" href="#count" title="Permalink to this headline">¶</a></h3>
<p>Verify that the file count is as specified</p>
<dl class="docutils">
<dt>It takes the following parameters:</dt>
<dd><ul class="first last simple">
<li><tt class="docutils literal"><span class="pre">filepattern</span></tt> is a glob for the files to count</li>
<li><tt class="docutils literal"><span class="pre">count</span></tt> is a specification for how many, it can be
&gt;=X, &lt;=X, &gt;X, &lt;X, =X or just X (which is equivalent to =X) where X is any
whole number.</li>
</ul>
</dd>
</dl>
</div>
<div class="section" id="exists-aliases-exist">
<h3><a class="toc-backref" href="#id17">exists  (aliases exist)</a><a class="headerlink" href="#exists-aliases-exist" title="Permalink to this headline">¶</a></h3>
<p>check if the path (file or directory) exists or not.
If the path exists - then it returns true.
example:</p>
<div class="highlight-python"><pre># if there is machine specific configuration then load it
- if exists &lt;shell.computername&gt;.bb:
    - include &lt;shell.computername&gt;.bb</pre>
</div>
</div>
<div class="section" id="notexists-aliases-notexist">
<h3><a class="toc-backref" href="#id18">notexists  (aliases notexist)</a><a class="headerlink" href="#notexists-aliases-notexist" title="Permalink to this headline">¶</a></h3>
<p>check if the path (file or directory) exists or not.
If the path does not exist - then it returns true. This can be useful
if you want to raise an error becuase one or more files does not exist.</p>
</div>
</div>
<div class="section" id="string-text-manipulation">
<h2><a class="toc-backref" href="#id19">String/text Manipulation</a><a class="headerlink" href="#string-text-manipulation" title="Permalink to this headline">¶</a></h2>
<div class="section" id="escapenewlines-aliases-escape-newlines">
<h3><a class="toc-backref" href="#id20">escapenewlines  (aliases escape_newlines)</a><a class="headerlink" href="#escapenewlines-aliases-escape-newlines" title="Permalink to this headline">¶</a></h3>
<p>r and n characters in the input will be replaced with \r and \n
respectively.</p>
</div>
<div class="section" id="replace">
<h3><a class="toc-backref" href="#id21">replace</a><a class="headerlink" href="#replace" title="Permalink to this headline">¶</a></h3>
<p>Allows you to replace text in a string</p>
<p>Usage:</p>
<div class="highlight-python"><pre>replace text to search in {*text to find*} {*replace with*}</pre>
</div>
<p>Example:</p>
<div class="highlight-python"><pre># get the contents of the text file
- ser serverlocation = http://code.google.com/p/betterbatch/
- set mail_contents = {{{ type email_template.txt }}}

# replace the text 'SERVERLOCATION' in the email templaet
# with 'http://code.google.com/p/betterbatch/'
- echo {{{replace &lt;mail_contents&gt; {*SERVERLOCATION*} {*&lt;serverlocation&gt;*} }}}</pre>
</div>
</div>
<div class="section" id="compare">
<h3><a class="toc-backref" href="#id22">compare</a><a class="headerlink" href="#compare" title="Permalink to this headline">¶</a></h3>
<p>The compare functionality is usually used in if statements. The examples
give will show them in that context.</p>
<p>Usage:</p>
<div class="highlight-python"><pre>compare text1 OPERATOR text2</pre>
</div>
<p>Operators can be one of:</p>
<div class="highlight-python"><pre>&gt;=
&lt;=
&gt;
&lt;
=
!=
startswith
endswith
contains
matches_regex</pre>
</div>
<p>Example:</p>
<div class="highlight-python"><pre>- set answer = {{{ get answer from somewhere }}}
- if compare &lt;answer&gt; = no:
   - Do something when it is no</pre>
</div>
<p>It can take the following qualifiers:</p>
<dl class="docutils">
<dt><strong>nocase</strong></dt>
<dd>Ignore case of the strings being compared.</dd>
<dt><strong>asint</strong></dt>
<dd>Treat both parameters as integers. Comparison of some items
will be different if they are treated as integers. For example
<tt class="docutils literal"><span class="pre">01</span> <span class="pre">=</span> <span class="pre">1</span></tt> will return false when treated as strings but true when
treated as integers.</dd>
</dl>
</div>
<div class="section" id="upper-aliases-uppercase">
<h3><a class="toc-backref" href="#id23">upper  (aliases uppercase)</a><a class="headerlink" href="#upper-aliases-uppercase" title="Permalink to this headline">¶</a></h3>
<p>Return an uppercase version of the string</p>
</div>
<div class="section" id="lower-aliases-lowercase">
<h3><a class="toc-backref" href="#id24">lower  (aliases lowercase)</a><a class="headerlink" href="#lower-aliases-lowercase" title="Permalink to this headline">¶</a></h3>
<p>Return an lowercase version of the string</p>
</div>
</div>
<div class="section" id="registry-manipulation">
<h2><a class="toc-backref" href="#id25">Registry Manipulation</a><a class="headerlink" href="#registry-manipulation" title="Permalink to this headline">¶</a></h2>
<div class="section" id="getregistryvalue">
<h3><a class="toc-backref" href="#id26">GetRegistryValue</a><a class="headerlink" href="#getregistryvalue" title="Permalink to this headline">¶</a></h3>
<p>Return the value of a registry key</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd><p class="first"><tt class="docutils literal"><span class="pre">GetRegistryValue</span> <span class="pre">[options]</span> <span class="pre">(keypath)</span> <span class="pre">[value_name]</span></tt></p>
<div class="last line-block">
<div class="line">Options:</div>
<div class="line-block">
<div class="line">-h, &#8211;help    show this help message and exit</div>
<div class="line">-e, &#8211;expand  if the registry type is REG_EXPAND_SZ - then expand variables</div>
<div class="line">&#8211;x64         operate on 64bit registry hiveOptions:</div>
</div>
</div>
</dd>
</dl>
<p><tt class="docutils literal"><span class="pre">keypath</span></tt> should begin with one of the standard registry keys HKLM,
HKEY_CURRENT_USER, etc.</p>
<p><tt class="docutils literal"><span class="pre">value_name</span></tt> is optional - if not provided then the value for default key will
be returned.</p>
<p>Example:</p>
<div class="highlight-python"><pre># print out the current path
- echo {{{ GetRegistryValue "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" path }}}</pre>
</div>
</div>
<div class="section" id="setregistryvalue">
<h3><a class="toc-backref" href="#id27">SetRegistryValue</a><a class="headerlink" href="#setregistryvalue" title="Permalink to this headline">¶</a></h3>
<dl class="docutils">
<dt>Usage:</dt>
<dd><p class="first"><tt class="docutils literal"><span class="pre">SetRegistryValue</span> <span class="pre">[options]</span> <span class="pre">(keypath)</span> <span class="pre">(value_name)</span> <span class="pre">(new_value)</span></tt></p>
<div class="last line-block">
<div class="line">Options:</div>
<div class="line-block">
<div class="line">-h, &#8211;help            show this help message and exit</div>
<div class="line">-t VALUE_TYPE, &#8211;value-type=VALUE_TYPE</div>
<div class="line-block">
<div class="line">when creating a new value - the value type to use.When</div>
<div class="line">changing existing values - the same type is used.</div>
</div>
<div class="line">&#8211;x64                 operate on 64bit registry hive</div>
</div>
</div>
</dd>
</dl>
<p><tt class="docutils literal"><span class="pre">keypath</span></tt> and <tt class="docutils literal"><span class="pre">value_name</span></tt> are the same as for <tt class="docutils literal"><span class="pre">GetRegistryValue()</span></tt>.
<tt class="docutils literal"><span class="pre">new_value</span></tt> is the new value to set the registry entry to.</p>
<p>Examples:</p>
<div class="highlight-python"><pre># Ensure that hidden files are showed
- SetRegistryValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" Hidden 1

# show file extensions
- SetRegistryValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" HideFileExt 0

# do not use the search assistant
- SetRegistryValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState" "Use Search Asst" no</pre>
</div>
</div>
</div>
<div class="section" id="miscelaneous-commands">
<h2><a class="toc-backref" href="#id28">Miscelaneous commands</a><a class="headerlink" href="#miscelaneous-commands" title="Permalink to this headline">¶</a></h2>
<div class="section" id="getlanguage">
<h3><a class="toc-backref" href="#id29">GetLanguage</a><a class="headerlink" href="#getlanguage" title="Permalink to this headline">¶</a></h3>
<p>Return language information from the database - &#8220;langinfo.csv&#8221; (included in the
betterbatch/tools folder along with GetLanguage.py)</p>
<dl class="docutils">
<dt>Usage:</dt>
<dd>GetLanguage langname format</dd>
<dt>Where:</dt>
<dd>langname is the 3 letter identifier e.g. deu, fra, jpn, kor, etc
format is one of the headers from langinfo.csv, e.g. dotnet, hex_lcid, etc.</dd>
</dl>
<p>For example:</p>
<div class="highlight-python"><pre>- set dotnetlang = {{{ GetLanguage &lt;lang&gt; dotnet }}}</pre>
</div>
</div>
<div class="section" id="add-tools-dir">
<h3><a class="toc-backref" href="#id30">add_tools_dir</a><a class="headerlink" href="#add-tools-dir" title="Permalink to this headline">¶</a></h3>
<p>The betterbatch/tools directory is added as a &#8216;tools&#8217; directory by default.</p>
<p>You can add other directories to be used as &#8216;tools&#8217; directories by using this
command.</p>
<p>Adding a tools directory means you do not have to specify the path to the
command.</p>
</div>
<div class="section" id="split">
<span id="split-built-in"></span><h3><a class="toc-backref" href="#id31">split</a><a class="headerlink" href="#split" title="Permalink to this headline">¶</a></h3>
<p>This command takes a list of items and &#8216;splits&#8217; them up. This is especially
useful in conjunction with the <tt class="docutils literal"><span class="pre">for</span></tt> statement.</p>
<p>Here is a simple example:</p>
<div class="highlight-python"><pre>- set names = John Mary Wilbur

- echo {{{ split &lt;names&gt;}}}</pre>
</div>
<p>The output will be:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">John</span>
<span class="n">Mary</span>
<span class="n">Wilbur</span>
</pre></div>
</div>
<p>By default is splits on any whitespace character, but you can specify any
text to be used to split on:</p>
<blockquote>
<div><ul class="simple">
<li>set names = John is connected to Mary is connected to Wilbur</li>
<li>echo {{{ split &lt;names&gt; {<em>is connected to</em>} }}}</li>
</ul>
</div></blockquote>
<p>The output will (still) be:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">John</span>
<span class="n">Mary</span>
<span class="n">Wilbur</span>
</pre></div>
</div>
<p>The split command is not very useful on it&#8217;s own - but it is very useful when
used with <tt class="docutils literal"><span class="pre">for</span></tt> statements.</p>
<dl class="docutils">
<dt>See Also</dt>
<dd><ul class="first last simple">
<li><a class="reference internal" href="readme.html#for-statement"><em>For statements</em></a> - The <tt class="docutils literal"><span class="pre">for</span></tt> statement</li>
</ul>
</dd>
</dl>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">The available built-in commands are:</a><ul>
<li><a class="reference internal" href="#running-shell-external-commands">Running shell/external commands</a><ul>
<li><a class="reference internal" href="#run-aliases-execute-system-default">run (aliases: execute, system). (default)</a></li>
<li><a class="reference internal" href="#which">which</a></li>
</ul>
</li>
<li><a class="reference internal" href="#path-manipulation">Path Manipulation</a><ul>
<li><a class="reference internal" href="#dirname">dirname</a></li>
<li><a class="reference internal" href="#filename-aliases-basename">filename    (aliases basename)</a></li>
<li><a class="reference internal" href="#abspath">abspath</a></li>
<li><a class="reference internal" href="#shortpathname">ShortPathName</a></li>
</ul>
</li>
<li><a class="reference internal" href="#file-manipulation">File Manipulation</a><ul>
<li><a class="reference internal" href="#find-in-file">find_in_file</a></li>
<li><a class="reference internal" href="#replace-in-file">replace_in_file</a></li>
<li><a class="reference internal" href="#listfilesmatchingpattern">ListFilesMatchingPattern</a></li>
<li><a class="reference internal" href="#count">count</a></li>
<li><a class="reference internal" href="#exists-aliases-exist">exists  (aliases exist)</a></li>
<li><a class="reference internal" href="#notexists-aliases-notexist">notexists  (aliases notexist)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#string-text-manipulation">String/text Manipulation</a><ul>
<li><a class="reference internal" href="#escapenewlines-aliases-escape-newlines">escapenewlines  (aliases escape_newlines)</a></li>
<li><a class="reference internal" href="#replace">replace</a></li>
<li><a class="reference internal" href="#compare">compare</a></li>
<li><a class="reference internal" href="#upper-aliases-uppercase">upper  (aliases uppercase)</a></li>
<li><a class="reference internal" href="#lower-aliases-lowercase">lower  (aliases lowercase)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#registry-manipulation">Registry Manipulation</a><ul>
<li><a class="reference internal" href="#getregistryvalue">GetRegistryValue</a></li>
<li><a class="reference internal" href="#setregistryvalue">SetRegistryValue</a></li>
</ul>
</li>
<li><a class="reference internal" href="#miscelaneous-commands">Miscelaneous commands</a><ul>
<li><a class="reference internal" href="#getlanguage">GetLanguage</a></li>
<li><a class="reference internal" href="#add-tools-dir">add_tools_dir</a></li>
<li><a class="reference internal" href="#split">split</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="readme.html"
                        title="previous chapter">BetterBatch Readme</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="comparison.html"
                        title="next chapter">Comparing BetterBatch to ...</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/built_in_commands.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="comparison.html" title="Comparing BetterBatch to ..."
             >next</a> |</li>
        <li class="right" >
          <a href="readme.html" title="BetterBatch Readme"
             >previous</a> |</li>
        <li><a href="index.html">BetterBatch v1.3.2 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2010, Mark Mc Mahon.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>